package cn.weisoft.redisdemo.model;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@Qualifier("Listener2")
public class RedisMessageListener2 implements MessageListener {
    @Override
    public void onMessage(Message message, byte[] bytes) {

        System.out.println("process message on onMessage 2:" + new Date());
        String body = new String(message.getBody());
        String topic = new String(bytes);
        System.out.println("body from RedisMessageListener2:" + body);
        System.out.println("topic from RedisMessageListener2:" + topic);
    }
}
